#ifndef GAMEMANAGER_HPP
#define GAMEMANAGER_HPP

/**
  * @file GameManager.hpp
  * @author Ryan Van Why
  * @brief This class manages the various minigames.
  * It is responsible for running the correct game, cycling through
  * games, changing games.
  */

// Forward declare this class, otherwise the GameMain
// class won't compile.
namespace mindsweeper {
namespace main {
class GameManager;
}
}

// Boost
#include <boost/algorithm/string.hpp> // Conversion of string to lowercase

// This lets us access various methods and objects (such as the window)
#include "GameMain.hpp"

// The games
#include <maze/Maze.hpp>

namespace mindsweeper {
namespace main {

class GameManager {
	public:
		/**
		  * @brief The constructor. Pretty basic.
		  * @param game_main A pointer to the GameMain instance
		  */
		GameManager(GameMain *game_main);

		/**
		  * @brief This sets a new game as active.
		  * @param new_game The new game to run.
		  * @return The new game.
		  */
		Game& changeGame(std::string new_game);

		/**
		  * @brief This handles an event.
		  * @param event The event to be handled.
		  * This may handle it directly or forward it to sub-games.
		  */
		void processEvent(sf::Event &event);

		/**
		  * @brief Renders the current game.
		  */
		void render();

		/**
		  * @brief Runs the current game's logic.
		  */
		void update();
	
	private:
		// A pointer to the GameMain instance.
		GameMain   *gameMain;

		// A pointer to the current game.
		Game       *currentGame;

		// The maze game
		maze::Maze *maze;
};

// End namespaces
}
}

#endif // GAMEMANAGER_HPP
